shortcutmanager: Use g_list_store_find()
authorTimm Bäder <mail@baedert.org>
Sat, 26 Dec 2020 08:59:46 +0000 (09:59 +0100)
committerTimm Bäder <mail@baedert.org>
Sun, 3 Jan 2021 10:01:29 +0000 (11:01 +0100)
We require glib 2.66 these days, so we can unconditionally use
g_list_store_find().

gtk/gtkshortcutmanager.c

index 0351490df24f1aea93df02800240900c711673ff..ec70791e7702d3834e5963a974a586aa43758d34 100644 (file)
@@ -108,24 +108,11 @@ gtk_shortcut_manager_default_remove_controller (GtkShortcutManager    *self,
   if (model)
     {
       GListModel *store;
-      guint position, len;
+      guint position;
 
       store = gtk_flatten_list_model_get_model (model);
-#if 0 && GLIB_CHECK_VERSION(2,64,0)
-      if (_g_list_store_find (G_LIST_STORE (store), controller, &position))
+      if (g_list_store_find (G_LIST_STORE (store), controller, &position))
         g_list_store_remove (G_LIST_STORE (store), position);
-#else
-      for (position = 0, len = g_list_model_get_n_items (store); position < len; position++)
-        {
-          GtkShortcutController *item = g_list_model_get_item (store, position);
-          g_object_unref (item);
-          if (item == controller)
-            {
-              g_list_store_remove (G_LIST_STORE (store), position);
-              break;
-            }
-        }
-#endif
     }
 }